In modern computer operating systems, two processes may exchange data using synchronous and asynchronous methods of interprocess communication. Interprocess communication (IPC) generally includes a set of methods of exchanging data among a group of threads in one or more processes. The processes can be launched on one or more computers, linked by a network. IPC methods are divided into methods of message passing, synchronization, shared memory and remote procedure calls. If a process performs an asynchronous operation, the process does not require a response to the operation to continue its execution. If a process performs a synchronous operation, the process requires a response to the operation continue its execution. Operation is an elementary action executed in the context of a particular process (for example, an API function call).
The synchronous and asynchronous mechanisms of interprocess communication are generally used for different purposes and have advantages and drawbacks. Asynchronous operations allow a process to continue working without waiting for a response to the operation, but they may be slower, require more resources of the operating system, and may be complicated to predict. On the other hand, synchronous operations may be faster, require fewer resources of the operating system, and may be easy to predict, but they do not allow the process to continue working until a response to the operation is received.
However, situations arise in the communication between processes where it may become inefficient to execute a certain task through asynchronous calls, for example, when the resources that the process is working with are free at the moment, the required data has been previously stored in cache, and other instances. In such cases, it is more advantageous to perform the required task using synchronous operation, since it will be executed quickly. Likewise, there are situations in which asynchronous operations may be more preferable.
Therefore, there is a need for a mechanism for choosing between the synchronous and asynchronous method of interprocess communication.